<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="breadcrumbs">
            <h:form id="menuHeader">
                <a href="index.xhtml">Website Admin</a><div class="breadcrumb_divider"></div>
                <h:commandLink value="Add subject" class="current"/>
            </h:form>
        </ui:define>
        <ui:define name="body">
            <h:form styleClass="jsfcrud_list_form" id="form">
                <h:panelGroup id="messagePanel" layout="block">
                    <h:messages errorClass="errorStyle" infoClass="infoStyle" layout="table" >
                    </h:messages>
                </h:panelGroup>

                <h:outputText escape="false" value="#{bundle.ListClassesEmpty}" rendered="#{usersController.items.rowCount == 0}" class="infoStyle"> 
                </h:outputText>
                <article class="module width_full">
                    <header><h3>faculty details</h3></header>
                    <div class="module_content">
                        <h:panelGrid columns="4" width="100%">
                            <h:outputText value="Username: " />
                            <h:outputText value="#{usersController.userSubj.username}" />
                            <h:outputText value="Full name: " />
                            <h:outputText value="#{usersController.userSubj.firstName} #{usersController.userSubj.lastName}" />
                        </h:panelGrid>
                    </div>
                </article>
                <article class="module width_full">
                    <header><h3>Add subject to faculty</h3></header>
                    <div class="module_content">
                        <h:panelGrid columns="1" width="100%">
                            <p:dataTable id="studentSearch" var="item" value="#{usersController.listSubject}" style="width: 100%" styleClass="tablesorter" 
                                         selection="#{usersController.listSubjectSelected}" rowKey="#{item.id}" >  
                            
                            <p:column selectionMode="multiple" style="width:2%" />
                            <p:column headerText="Id" >  
                                #{item.id}  
                            </p:column>
                            
                            <p:column headerText="subject">  
                                #{item.suName}  
                            </p:column>
                        </p:dataTable>
                            <h:commandButton value="Save" actionListener="#{usersController.addSubject}"/> 
                        </h:panelGrid>
                    </div>
                </article>
            </h:form>
        </ui:define>
    </ui:composition>

</html>